package com.example.cloudpracticeplatform.controller;


import com.example.cloudpracticeplatform.common.Response;
import com.example.cloudpracticeplatform.entity.Enrollment;
import com.example.cloudpracticeplatform.service.EnrollmentService;
import com.example.cloudpracticeplatform.service.ExperimentContainersService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/experimentContainers")
@CrossOrigin
public class ExperimentContainersControlelr {
    @Resource
    private ExperimentContainersService experimentContainersService;
    
    @Resource
    private EnrollmentService enrollmentService;
    
    @PostMapping("/get")
    public Response getExperimentContainer(@RequestParam Integer studentId, @RequestParam Integer courseId){
        Enrollment enrollment = enrollmentService.findEnrollment(studentId, courseId);
        return Response.success(experimentContainersService.findByEnrollmentId(enrollment.getEnrollmentId()));
    }
    
    
}
